Introduction:
This project focuses on developing regression models utilizing time series data from the Central Bank of the Republic of Turkey (CBRT) and Google Trends. Aim of the project is to fit time series regression models for selected economic measures including House Price Index, Money Supply, and Unemployment Rate by using time series data. In our regression model, the categories we mentioned, House Price Index, Money Supply, and Unemployment Rate, will serve as dependent variables whereas search terms from Google Trends will serve as independent variables. Time series regression models are built with monthly data from 2014 to 2024 from CBRT and Google Trends. Two important data sources are used in this study. The main source of economic statistics is the Central Bank of the Republic of Turkey (CBRT), which offers a wide range of indicators. As mentioned earlier, CBRT indicators are used as dependent variables in the project and Google Trends is used as the source of our independent variables. Google Trends platform provides information about online search behavior of people, making it possible to analyze search trends over time. In the first model we are constructing a time series regression model for the House Price Index, which is one of the major indicators for understanding the dynamics of the real estate market. In this model, the House Price Index serves as the dependent variable while search terms including "satılık ev" (houses for sale), "konut kredisi" (mortgage), and "faiz" (interest rates) from Google trends serve as predictor (independent) variables. The selection of these independent variables was justified by their possible impact on changes in the housing market. The word "satılık ev" (houses for sale) represents the amount of interest and demand present in the real estate market. Higher "satılık ev" search volumes suggest more people are interested in buying properties, which can raise housing prices. "Konut kredisi" (mortgage) is key component of financing home purchases, and the search volume of it may represent thenconsumer interest in mortgage loans. Variations in mortgage availability and interest rates have a direct impact on housing affordability, which in turn affects home prices. "Faiz" (interest rates) is a key factor in determining the dynamics of the housing market. Higher interest rates typically stifle the demand for mortgages, which lowers housing affordability and, as a result, drives down house prices. On the other hand, reduced interest rates increase demand and drive-up housing costs. In the second model we are constructing a time series regression model for Money Supply which is a crucial economic metric that indicates the total amount of money in use in a given economy. In this model, the Money Supply serves as the dependent variable while search terms including "faiz" (interest rates), “enflasyon” (inflation), “darphane” (mint), and “altın” (gold) from Google trends serve as predictor (independent) variables. The rationale behind the selection of independent variables from Google Trends is their capacity to have significant influence on the dynamics of Money Supply. The "faiz" (interest rates) have a major impact on the dynamics of the money supply and monetary policy. Interest rate fluctuations can have an effect on lending and borrowing practices, which can change the amount of money in the economy overall. The term "enflasyon" (inflation) is a crucial economic indicator that policy-makers actively watch. Variations in inflation rates have the potential to impact investment choices, consumer spending habits, and ultimately the dynamics of the money supply. Public interest in minting activities is reflected in the phrase "darphane" (mint), which may be a sign of shifts in the demand for currency or government intervention in the money supply. As a safe-haven asset and store of wealth, "altın" (gold) is very important in the world economy. Changes in investor attitude and confidence could be reflected in fluctuations in gold prices, which could influence the dynamics of the money supply. In our third and final model, we are constructing a time series regression model for Unemployment Rate, a crucial economic indicator that represents the percentage of the labor force that is unemployed and actively looking for work. In this model, the Unemployment Rate serves as the dependent variable while search terms including "iş ilanları" (job advertisement), "enflasyon" (inflation), "salgın hastalık" (epidemic disease), "işsizlik sigortası" (unemployment insurance), and "işsizlik" (unemployment) from Google trends serve as predictor (independent) variables. These carefully selected Google Trends search phrases provide insightful information about a range of variables affecting the dynamics of unemployment. The public's interest in job advertisements, which might offer insights into employment opportunities and labor market dynamics, is reflected in the search term "iş ilanları". Inflationary pressures known as "enflasyon" can affect corporate expenses and consumer purchasing power, which can therefore effect hiring decisions and unemployment rates. The occurrence of "salgın hastalık" (epidemic diseases), like the COVID-19 pandemic, may have a significant impact on labor markets, resulting in job losses, interruptions to the economy, and adjustments to employment patterns. Concerns about job security and the possibility of unemployment may be the source of interest in "işsizlik sigortası" (unemployment insurance), which can reveal attitudes toward the labor market. The public's interest in unemployment concerns is directly captured by searches pertaining to "işsizlik" (unemployment), which reflects underlying patterns and sentiment regarding labor market situations. Finally, to evaluate the effectiveness of the model, a number of statistical tests (Breusch Godfrey etc.) and metrics (R square, corresponding p-values of coefficients of independent variables) were used. These included tests for autocorrelation, examination of the model's goodness of fit, and analysis of residuals. The objective of closely examining these elements was to ensure the reliability and resilience of the time series regression models we have developed for the Money Supply, Unemployment Rate, and House Price Index.
First, we start by showing the required libraries that we will use in our code.
require(data.table)
require(lubridate)
require(forecast)
require(skimr)
require(repr)
require(readxl)
require(ggplot2)
Zorunlu paket yükleniyor: data.table
Zorunlu paket yükleniyor: lubridate
Attaching package: ‘lubridate’
The following objects are masked from ‘package:data.table’:
hour, isoweek, mday, minute, month, quarter, second, wday, week,
yday, year
The following objects are masked from ‘package:base’:
date, intersect, setdiff, union
Zorunlu paket yükleniyor: forecast
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
Zorunlu paket yükleniyor: skimr
Zorunlu paket yükleniyor: repr
Zorunlu paket yükleniyor: readxl
Zorunlu paket yükleniyor: ggplot2
In this part, I have downloaded house index, money supply, and unemployment rate data from TCMB as xlsx file and manipulated those data such that all shows the data between 01.01.2014 - 01.01.2024. Besides, I have created time series objects for each data in order to use them in forecasting. All three sets of data provided below will be our dependent variables, which we will be trying to create the models of them.
house_index_data <- read_excel("Desktop/360R/house_price_index.xlsx")
house_index_data <- house_index_data[31:152, ]
house_index_data <- house_index_data[,-3]
colnames(house_index_data) <- c("Date", "House Price Index")
house_index_data$Date <- as.Date(paste(house_index_data$Date, "-01", sep = ""))
house_index_data$"House Price Index" <- as.numeric(house_index_data$"House Price Index")
initial_time <- c(year(min(house_index_data$Date)), month(min(house_index_data$Date)))
house_index_ts <- ts(house_index_data$"House Price Index", start = initial_time, frequency = 12)
house_index_ts
New names:
• `` -> `...3`
| Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2014 | 64.1 | 64.8 | 65.7 | 66.8 | 67.5 | 68.2 | 69.3 | 70.2 | 70.9 | 71.5 | 72.4 | 73.1 |
| 2015 | 74.2 | 75.4 | 76.6 | 77.7 | 78.9 | 79.9 | 80.6 | 81.1 | 81.7 | 82.7 | 83.7 | 84.5 |
| 2016 | 85.7 | 86.6 | 87.5 | 88.6 | 89.7 | 90.5 | 91.3 | 92.3 | 92.8 | 93.5 | 94.0 | 94.8 |
| 2017 | 95.5 | 96.7 | 97.9 | 98.7 | 99.8 | 100.3 | 100.5 | 100.8 | 101.4 | 102.2 | 102.8 | 103.4 |
| 2018 | 104.1 | 104.8 | 105.7 | 107.1 | 108.6 | 109.1 | 109.3 | 108.7 | 107.8 | 108.5 | 109.2 | 108.0 |
| 2019 | 107.6 | 108.6 | 109.0 | 109.3 | 110.2 | 111.0 | 112.4 | 114.4 | 115.2 | 116.0 | 117.1 | 118.8 |
| 2020 | 120.9 | 123.7 | 125.4 | 127.5 | 135.9 | 139.5 | 141.4 | 144.4 | 146.7 | 149.9 | 152.2 | 154.9 |
| 2021 | 157.7 | 161.7 | 165.5 | 168.8 | 175.4 | 180.3 | 185.4 | 192.7 | 198.9 | 210.2 | 229.2 | 247.4 |
| 2022 | 279.9 | 318.0 | 347.7 | 383.0 | 431.1 | 470.0 | 507.8 | 548.2 | 575.0 | 605.8 | 629.2 | 662.7 |
| 2023 | 708.5 | 768.1 | 809.6 | 847.4 | 878.0 | 921.0 | 988.7 | 1043.1 | 1087.9 | 1129.5 | 1150.0 | 1163.3 |
| 2024 | 1190.0 | 1213.0 |
M1_data <- read_excel("Desktop/360R/M1.xlsx")
M1_data <- M1_data[29:150, ]
M1_data <- M1_data[,-3]
colnames(M1_data) <- c("Date", "M1")
M1_data$Date <- as.Date(paste(M1_data$Date, "-01", sep = ""))
M1_data$"M1" <- as.numeric(M1_data$"M1")
initial_time <- c(year(min(M1_data$Date)), month(min(M1_data$Date)))
M1_ts <- ts(M1_data$"M1", start = initial_time, frequency = 12)
M1_ts
New names:
• `` -> `...3`
| Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2014 | 222778962 | 221554826 | 229538298 | 225530537 | 224382058 | 238150238 | 247677613 | 241878967 | 249785641 | 247424552 | 245494451 | 251991723 |
| 2015 | 251419161 | 256672749 | 261935572 | 273990507 | 280246416 | 285907662 | 294157799 | 302536632 | 322378630 | 308090197 | 307160179 | 312005973 |
| 2016 | 307780794 | 312767158 | 315704986 | 322480264 | 325211114 | 336562968 | 344856750 | 343756071 | 347747515 | 348794511 | 359751417 | 382351496 |
| 2017 | 376732225 | 377212027 | 401173247 | 419127390 | 411475365 | 421573145 | 419416200 | 433232693 | 434181238 | 429971761 | 437243382 | 449631796 |
| 2018 | 428232624 | 433707515 | 451583613 | 463082040 | 496312574 | 513594608 | 509485823 | 588067823 | 559184535 | 523005315 | 488062659 | 512524057 |
| 2019 | 505911428 | 517326639 | 569489652 | 567678259 | 612272035 | 608264637 | 602826683 | 641486805 | 655504373 | 666800207 | 677077915 | 712832597 |
| 2020 | 736761246 | 787440698 | 847047260 | 1004180564 | 1049003890 | 1101587027 | 1195463719 | 1212171623 | 1230939243 | 1274992753 | 1256046133 | 1219863695 |
| 2021 | 1196836433 | 1174517579 | 1221726118 | 1274480359 | 1339713644 | 1375019253 | 1414025729 | 1413801938 | 1461023866 | 1566529670 | 1873167065 | 2097220269 |
| 2022 | 2117864069 | 2184427231 | 2307772436 | 2382053021 | 2539199585 | 2662097003 | 2739907121 | 2775476404 | 2857946610 | 2950589658 | 2987390833 | 3131103033 |
| 2023 | 3173757166 | 3250031541 | 3469728070 | 3672319062 | 3523242342 | 4180536954 | 4390129243 | 4545752925 | 4492359898 | 4565790908 | 4631462146 | 4757514054 |
| 2024 | 4837221517 | 5049627766 |
unemployment_rate_data <- read_excel("Desktop/360R/unemployment_rate.xlsx")
unemployment_rate_data <- unemployment_rate_data[1:122, ]
unemployment_rate_data <- unemployment_rate_data[,-3]
colnames(unemployment_rate_data) <- c("Date", "Rate")
unemployment_rate_data$Date <- as.Date(paste(unemployment_rate_data$Date, "-01", sep = ""))
unemployment_rate_data$"Rate" <- as.numeric(unemployment_rate_data$"Rate")
initial_time <- c(year(min(unemployment_rate_data$Date)), month(min(unemployment_rate_data$Date)))
unemployment_rate_ts <- ts(unemployment_rate_data$"Rate", start = initial_time, frequency = 12)
unemployment_rate_ts
New names:
• `` -> `...3`
| Jan | Feb | Mar | Apr | May | Jun | Jul | Aug | Sep | Oct | Nov | Dec | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2014 | 10.5 | 10.5 | 9.4 | 8.8 | 8.4 | 9.0 | 9.7 | 10.1 | 10.1 | 10.9 | 10.4 | 10.8 |
| 2015 | 11.9 | 11.7 | 10.4 | 9.6 | 8.9 | 9.6 | 10.0 | 10.0 | 10.3 | 10.5 | 10.2 | 10.9 |
| 2016 | 11.5 | 11.0 | 10.1 | 9.1 | 9.0 | 10.1 | 11.0 | 11.0 | 11.8 | 11.9 | 11.6 | 12.8 |
| 2017 | 13.5 | 12.9 | 11.7 | 10.5 | 9.7 | 10.4 | 10.6 | 10.6 | 10.4 | 10.5 | 10.0 | 10.3 |
| 2018 | 11.0 | 10.8 | 9.8 | 9.3 | 9.4 | 10.2 | 10.7 | 11.1 | 11.4 | 11.7 | 12.0 | 13.3 |
| 2019 | 15.1 | 15.0 | 13.9 | 12.9 | 12.5 | 13.4 | 14.1 | 14.2 | 14.0 | 13.3 | 12.9 | 13.6 |
| 2020 | 14.1 | 13.5 | 13.0 | 12.8 | 12.6 | 13.0 | 14.6 | 13.0 | 12.4 | 12.8 | 12.9 | 13.0 |
| 2021 | 13.4 | 14.1 | 13.1 | 12.9 | 12.4 | 10.4 | 12.1 | 12.0 | 11.1 | 10.7 | 10.9 | 11.3 |
| 2022 | 12.1 | 11.4 | 11.4 | 10.6 | 10.1 | 9.7 | 10.6 | 9.8 | 9.9 | 9.9 | 9.9 | 10.4 |
| 2023 | 10.3 | 10.7 | 10.2 | 10.0 | 8.8 | 9.0 | 9.7 | 9.2 | 8.9 | 8.2 | 8.8 | 8.9 |
| 2024 | 9.8 | 9.7 |
Needed data manipulation for independent variables:
I have already downloaded different google trend data in order to use in our model as independent variables as I discussed in introduction section. In this part of the code, I have fetched data from csv files of each data set which I will be using in my models. Then I have manipulated data in time restriction which I have also done to dependent variables. Then I have created time series objects for each of the 10 independent variables. Then I have plotted them to observe their patterns and behaviours.
satılık_ev_data = fread("Desktop/360R/satılık_ev.csv")
colnames(satılık_ev_data) <- c("Date", "Amount")
satılık_ev_data$Date <- as.Date(paste(satılık_ev_data$Date, "-01", sep = ""))
satılık_ev_data <- satılık_ev_data[satılık_ev_data$Date >= as.Date("2014-01-01") & satılık_ev_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(satılık_ev_data$Date)), month(min(satılık_ev_data$Date)))
satılık_ev_ts <- ts(satılık_ev_data$Amount, start = initial_time, frequency = 12)
konut_kredisi_data = fread("Desktop/360R/konut_kredisi.csv")
colnames(konut_kredisi_data) <- c("Date", "Amount")
konut_kredisi_data$Date <- as.Date(paste(konut_kredisi_data$Date, "-01", sep = ""))
konut_kredisi_data <- konut_kredisi_data[konut_kredisi_data$Date >= as.Date("2014-01-01") & konut_kredisi_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(konut_kredisi_data$Date)), month(min(konut_kredisi_data$Date)))
konut_kredisi_ts <- ts(konut_kredisi_data$Amount, start = initial_time, frequency = 12)
faiz_data = fread("Desktop/360R/faiz.csv")
colnames(faiz_data) <- c("Date", "Amount")
faiz_data$Date <- as.Date(paste(faiz_data$Date, "-01", sep = ""))
faiz_data <- faiz_data[faiz_data$Date >= as.Date("2014-01-01") & faiz_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(faiz_data$Date)), month(min(faiz_data$Date)))
faiz_ts <- ts(faiz_data$"Amount", start = initial_time, frequency = 12)
enflasyon_data = fread("Desktop/360R/enflasyon.csv")
colnames(enflasyon_data) <- c("Date", "Amount")
enflasyon_data$Date <- as.Date(paste(enflasyon_data$Date, "-01", sep = ""))
enflasyon_data <- enflasyon_data[enflasyon_data$Date >= as.Date("2014-01-01") & enflasyon_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(enflasyon_data$Date)), month(min(enflasyon_data$Date)))
enflasyon_ts <- ts(enflasyon_data$Amount, start = initial_time, frequency = 12)
darphane_data = fread("Desktop/360R/darphane.csv")
colnames(darphane_data) <- c("Date", "Amount")
darphane_data$Date <- as.Date(paste(darphane_data$Date, "-01", sep = ""))
darphane_data <- darphane_data[darphane_data$Date >= as.Date("2014-01-01") & darphane_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(darphane_data$Date)), month(min(darphane_data$Date)))
darphane_ts <- ts(darphane_data$Amount, start = initial_time, frequency = 12)
altın_data = fread("Desktop/360R/altın.csv")
colnames(altın_data) <- c("Date", "Amount")
altın_data$Date <- as.Date(paste(altın_data$Date, "-01", sep = ""))
altın_data <- altın_data[altın_data$Date >= as.Date("2014-01-01") & altın_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(altın_data$Date)), month(min(altın_data$Date)))
altın_ts <- ts(altın_data$Amount, start = initial_time, frequency = 12)
salgın_hastalık_data = fread("Desktop/360R/salgın_hastalık.csv")
colnames(salgın_hastalık_data) <- c("Date", "Amount")
salgın_hastalık_data$Date <- as.Date(paste(salgın_hastalık_data$Date, "-01", sep = ""))
salgın_hastalık_data <- salgın_hastalık_data[salgın_hastalık_data$Date >= as.Date("2014-01-01") & salgın_hastalık_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(salgın_hastalık_data$Date)), month(min(salgın_hastalık_data$Date)))
salgın_hastalık_ts <- ts(salgın_hastalık_data$Amount, start = initial_time, frequency = 12)
işsizlik_sigortası_data = fread("Desktop/360R/işsizlik_sigortası.csv")
colnames(işsizlik_sigortası_data) <- c("Date", "Amount")
işsizlik_sigortası_data$Date <- as.Date(paste(işsizlik_sigortası_data$Date, "-01", sep = ""))
işsizlik_sigortası_data <- işsizlik_sigortası_data[işsizlik_sigortası_data$Date >= as.Date("2014-01-01") & işsizlik_sigortası_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(işsizlik_sigortası_data$Date)), month(min(işsizlik_sigortası_data$Date)))
işsizlik_sigortası_ts <- ts(işsizlik_sigortası_data$Amount, start = initial_time, frequency = 12)
iş_ilanları_data = fread("Desktop/360R/iş_ilanları.csv")
colnames(iş_ilanları_data) <- c("Date", "Amount")
iş_ilanları_data$Date <- as.Date(paste(iş_ilanları_data$Date, "-01", sep = ""))
iş_ilanları_data <- iş_ilanları_data[iş_ilanları_data$Date >= as.Date("2014-01-01") & iş_ilanları_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(iş_ilanları_data$Date)), month(min(iş_ilanları_data$Date)))
iş_ilanları_ts <- ts(iş_ilanları_data$Amount, start = initial_time, frequency = 12)
işsizlik_data = fread("Desktop/360R/işsizlik.csv")
colnames(işsizlik_data) <- c("Date", "Amount")
işsizlik_data$Date <- as.Date(paste(işsizlik_data$Date, "-01", sep = ""))
işsizlik_data <- işsizlik_data[işsizlik_data$Date >= as.Date("2014-01-01") & işsizlik_data$Date <= as.Date("2024-02-01")]
initial_time <- c(year(min(işsizlik_data$Date)), month(min(işsizlik_data$Date)))
işsizlik_ts <- ts(işsizlik_data$Amount, start = initial_time, frequency = 12)
autoplot(satılık_ev_ts)
autoplot(konut_kredisi_ts)
autoplot(faiz_ts)
autoplot(enflasyon_ts)
autoplot(darphane_ts)
autoplot(altın_ts)
autoplot(salgın_hastalık_ts)
autoplot(işsizlik_sigortası_ts)
autoplot(iş_ilanları_ts)
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_ts' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_ts' in 'mbcsToSbcs': dot substituted for <b1>”
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_ts' in 'mbcsToSbcs': dot substituted for <b1>”
House Price Index Model:
First, I will be trying to model House Price Index time series. Plotting data is important for seeing important patterns and behaviours of the time series.
autoplot(house_index_ts) + ggtitle("House Price Index vs Time") + xlab("Year") + ylab("House Price Index")
Then I check the autocorrelation function of house price index time series. It can be seen that there is a high positive autocorelation for small lag values, which is even close to 1. It can be understood that our model should be an autoregressive model, where we should be using differencing methods in order to make our data stationary. However our aim in our homework is to find independent variables, we will not be working on it, but will neglect the effects of this behaviour at the end, for the residuals that we obtain.
ggAcf(house_index_ts, lag.max = 120)
ggAcf(house_index_ts)
I have created a dataframe in order to create rows, which I will be using in plotting.
df_house_index <- cbind(house_index_data[,-1], satılık_ev_data$Amount, konut_kredisi_data$Amount, faiz_data$Amount)
df_house_index
| House Price Index | satılık_ev_data$Amount | konut_kredisi_data$Amount | faiz_data$Amount |
|---|---|---|---|
| <dbl> | <int> | <int> | <int> |
| 64.1 | 23 | 9 | 19 |
| 64.8 | 23 | 9 | 19 |
| 65.7 | 21 | 7 | 15 |
| 66.8 | 21 | 8 | 17 |
| 67.5 | 22 | 8 | 16 |
| 68.2 | 22 | 8 | 16 |
| 69.3 | 22 | 9 | 15 |
| 70.2 | 26 | 10 | 15 |
| 70.9 | 24 | 10 | 15 |
| 71.5 | 24 | 8 | 13 |
| 72.4 | 25 | 8 | 15 |
| 73.1 | 22 | 8 | 16 |
| 74.2 | 23 | 9 | 17 |
| 75.4 | 29 | 11 | 19 |
| 76.6 | 29 | 10 | 17 |
| 77.7 | 27 | 8 | 15 |
| 78.9 | 25 | 8 | 13 |
| 79.9 | 24 | 8 | 14 |
| 80.6 | 29 | 7 | 13 |
| 81.1 | 31 | 9 | 15 |
| 81.7 | 26 | 8 | 16 |
| 82.7 | 25 | 7 | 14 |
| 83.7 | 27 | 11 | 21 |
| 84.5 | 27 | 9 | 22 |
| 85.7 | 27 | 8 | 17 |
| 86.6 | 31 | 9 | 18 |
| 87.5 | 33 | 9 | 21 |
| 88.6 | 33 | 12 | 23 |
| 89.7 | 32 | 10 | 21 |
| 90.5 | 29 | 10 | 19 |
| ⋮ | ⋮ | ⋮ | ⋮ |
| 198.9 | 45 | 15 | 54 |
| 210.2 | 43 | 21 | 58 |
| 229.2 | 45 | 21 | 75 |
| 247.4 | 47 | 20 | 80 |
| 279.9 | 46 | 16 | 58 |
| 318.0 | 46 | 16 | 47 |
| 347.7 | 49 | 16 | 57 |
| 383.0 | 48 | 15 | 46 |
| 431.1 | 55 | 44 | 70 |
| 470.0 | 50 | 21 | 58 |
| 507.8 | 50 | 16 | 57 |
| 548.2 | 47 | 14 | 52 |
| 575.0 | 40 | 15 | 57 |
| 605.8 | 35 | 12 | 51 |
| 629.2 | 32 | 11 | 54 |
| 662.7 | 35 | 13 | 50 |
| 708.5 | 47 | 57 | 62 |
| 768.1 | 53 | 17 | 46 |
| 809.6 | 43 | 16 | 56 |
| 847.4 | 38 | 14 | 51 |
| 878.0 | 34 | 14 | 54 |
| 921.0 | 37 | 14 | 100 |
| 988.7 | 44 | 17 | 88 |
| 1043.1 | 41 | 17 | 76 |
| 1087.9 | 35 | 17 | 96 |
| 1129.5 | 30 | 14 | 83 |
| 1150.0 | 27 | 11 | 81 |
| 1163.3 | 28 | 10 | 94 |
| 1190.0 | 29 | 12 | 73 |
| 1213.0 | 26 | 13 | 65 |
To obtain correlation matrix of our independent variables and dependent variable.
require(GGally)
ggpairs(df_house_index)
Zorunlu paket yükleniyor: GGally Registered S3 method overwritten by 'GGally': method from +.gg ggplot2 Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'satılık_ev_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
It can be observed that there is a high correlation between House Price Index and Faiz dataset, which is 0.670. To see different models, we will be creating models with different combinations of our independet variables and get the summary of them.
tslm_house_index_1 <- tslm(house_index_ts ~ satılık_ev_ts + konut_kredisi_ts + faiz_ts)
tslm_house_index_2 <- tslm(house_index_ts ~ konut_kredisi_ts + faiz_ts)
tslm_house_index_3 <- tslm(house_index_ts ~ faiz_ts)
summary(tslm_house_index_1)
summary(tslm_house_index_2)
summary(tslm_house_index_3)
Call:
tslm(formula = house_index_ts ~ satılık_ev_ts + konut_kredisi_ts +
faiz_ts)
Residuals:
Min 1Q Median 3Q Max
-564.78 -110.08 10.81 49.84 675.45
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -96.4869 67.6589 -1.426 0.156
satılık_ev_ts 1.4166 2.1740 0.652 0.516
konut_kredisi_ts -8.8782 2.1122 -4.203 5.14e-05 ***
faiz_ts 10.9634 0.9442 11.612 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 206.2 on 118 degrees of freedom
Multiple R-squared: 0.5401, Adjusted R-squared: 0.5284
F-statistic: 46.19 on 3 and 118 DF, p-value: < 2.2e-16
Call:
tslm(formula = house_index_ts ~ konut_kredisi_ts + faiz_ts)
Residuals:
Min 1Q Median 3Q Max
-578.20 -109.87 10.74 47.25 662.13
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -61.5598 41.1878 -1.495 0.138
konut_kredisi_ts -8.0424 1.6741 -4.804 4.58e-06 ***
faiz_ts 11.0305 0.9363 11.781 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 205.7 on 119 degrees of freedom
Multiple R-squared: 0.5384, Adjusted R-squared: 0.5307
F-statistic: 69.4 on 2 and 119 DF, p-value: < 2.2e-16
Call:
tslm(formula = house_index_ts ~ faiz_ts)
Residuals:
Min 1Q Median 3Q Max
-558.21 -127.84 14.37 57.71 739.54
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -122.5224 42.6369 -2.874 0.0048 **
faiz_ts 9.1690 0.9274 9.887 <2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 223.8 on 120 degrees of freedom
Multiple R-squared: 0.4489, Adjusted R-squared: 0.4443
F-statistic: 97.74 on 1 and 120 DF, p-value: < 2.2e-16
It can be seen that there is a high p value for satılık_ev coefficient, which results in the hypothesis that the we fail to reject that the corresponding coefficient is zero. Thus, I have also examined another models by subtracting satılık_ev data set. It can be seen that in second model, I obtained 0.5284 adjusted R squared value which indicates that how much of the variability in actual data can be explained by our model. 0.5284 might not be an indicator of a good model however, since I didn't apply any differencing method nor dummy variable, this value is good enough since our data is not even stationary.
Code below provides different metrics of our models. Akaike and Bayesian information criterion are metrics for penalized regression, where high amount of parameter coefficient and data amount are considered to be penalized. It can also be seen that my second model yeilds better result from all metrics.
CV_data <- data.frame(rbind(CV(tslm_house_index_1), CV(tslm_house_index_2), CV(tslm_house_index_3)))
CV_data
| CV | AIC | AICc | BIC | AdjR2 |
|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
| 46913.56 | 1306.135 | 1306.652 | 1320.155 | 0.5283751 |
| 46204.49 | 1304.573 | 1304.915 | 1315.789 | 0.5306556 |
| 51667.92 | 1324.199 | 1324.402 | 1332.611 | 0.4443005 |
To see the actual data and model result, I have plotted both to single graph. By eliminating outliers and stationarity, this model would have been improved.
autoplot(house_index_ts, series = "Actual Data") +
autolayer(fitted(tslm_house_index_2), series = "Model Result")
Then we check residuals for all three models by looking at their autocorrelation functions, residual distribution functions, and residual time series. It can be seen that there exists high positive autocorrelation for small lag numbers which I have expected to see at the beginning due to not applying differencing method since our dependent varaible data set was not stationary. However, the residual distribution graph does not seems to close to normal, which indicates that there is mode information and heterodasticity that is leftover, and that should be explained in our model. It can be seen that the Breusch-Godfrey test results have small p values, which are close to 0. Since Breush-Godfrey test has hypothesis 0 that there is not autocorrelation between residuals and the heterodasticity is low, and I obtained small p values, it concludes to reject that my resualds are not autocorrelated so the model does not perfectly describes the actual data.
checkresiduals(tslm_house_index_1)
checkresiduals(tslm_house_index_2)
checkresiduals(tslm_house_index_3)
Breusch-Godfrey test for serial correlation of order up to 24 data: Residuals from Linear regression model LM test = 97.864, df = 24, p-value = 6.935e-11
Breusch-Godfrey test for serial correlation of order up to 24 data: Residuals from Linear regression model LM test = 97.904, df = 24, p-value = 6.826e-11
Breusch-Godfrey test for serial correlation of order up to 24 data: Residuals from Linear regression model LM test = 105.46, df = 24, p-value = 3.47e-12
By drawing residuals vs fitted values data, it is importnat to observe the distribution of residuals. If residuals were likely to be normally distributed with mean zero and sigma squared, they should have scattered arround randomly, which would have indicated white noise series. However our residuals did not scattered randomly, which is not good to obtain as a result.
df_house_index[,"Residuals"] <- as.numeric(residuals(tslm_house_index_2))
ggplot(df_house_index, aes(x = fitted(tslm_house_index_2), y = Residuals)) + geom_point()
Don't know how to automatically pick scale for object of type <ts>. Defaulting
to continuous.
Money Supply Model:
In this section, I will be proceeding with Money Supply Model. Since I have explained the code in previous model, I will not be explaining it, just commanding on results in further models.
autoplot(M1_ts) + ggtitle("Money Supply vs Time") + xlab("Year") + ylab("Money Supply")
It can be observed that there is exists high autocorrelation for small amount of lags. Since there exists a regular downward trend in autocorrelation function, it should be thought that our model should be either autoregressive or we should be working with differenced data set.
ggAcf(M1_ts, lag.max = 120)
ggAcf(M1_ts)
From the autocorrelation function provided below, it can be seen that there have been significant amount of decreament in autocorrelation values for different lags when I applied 1 month differencing. By applying higher order differencing and box-cox transformation, this autocorrelation function would be fitted into the blue lines, two divided by root n, since the high autocorrelation was getting caused by non-stationary data. However I will be continuing with the non-differneced data since when I have checked the correlations between independent data set and lagged data set, I have obtained worse result since some independet data set also requires differencing and other needs since they are not also stationary. So I will be proceeding with non-stationary Money Supply 1 data set.
require(zoo)
M1_lag1dif <- diff(zoo(M1_data$M1),lag=1,differences = 1,na.pad = TRUE)
M1_lag1dif_ts <- ts(M1_lag1dif, frequency = 12)
ggAcf(M1_lag1dif_ts, lag.max = 120)
ggAcf(M1_lag1dif_ts)
Zorunlu paket yükleniyor: zoo
Attaching package: ‘zoo’
The following objects are masked from ‘package:data.table’:
yearmon, yearqtr
The following objects are masked from ‘package:base’:
as.Date, as.Date.numeric
df_M1 <- cbind(M1_data[,-1], faiz_data$Amount, enflasyon_data$Amount, darphane_data$Amount, altın_data$Amount)
df_M1
| M1 | faiz_data$Amount | enflasyon_data$Amount | darphane_data$Amount | altın_data$Amount |
|---|---|---|---|---|
| <dbl> | <int> | <int> | <int> | <int> |
| 222778962 | 19 | 9 | 7 | 12 |
| 221554826 | 19 | 5 | 8 | 10 |
| 229538298 | 15 | 4 | 7 | 9 |
| 225530537 | 17 | 5 | 9 | 8 |
| 224382058 | 16 | 5 | 9 | 7 |
| 238150238 | 16 | 5 | 9 | 8 |
| 247677613 | 15 | 5 | 10 | 7 |
| 241878967 | 15 | 3 | 9 | 7 |
| 249785641 | 15 | 3 | 10 | 7 |
| 247424552 | 13 | 4 | 11 | 6 |
| 245494451 | 15 | 4 | 10 | 9 |
| 251991723 | 16 | 5 | 8 | 8 |
| 251419161 | 17 | 9 | 9 | 10 |
| 256672749 | 19 | 6 | 9 | 10 |
| 261935572 | 17 | 6 | 10 | 8 |
| 273990507 | 15 | 5 | 9 | 8 |
| 280246416 | 13 | 7 | 7 | 6 |
| 285907662 | 14 | 9 | 6 | 7 |
| 294157799 | 13 | 7 | 7 | 8 |
| 302536632 | 15 | 4 | 6 | 10 |
| 322378630 | 16 | 4 | 6 | 7 |
| 308090197 | 14 | 4 | 7 | 6 |
| 307160179 | 21 | 6 | 11 | 9 |
| 312005973 | 22 | 9 | 8 | 7 |
| 307780794 | 17 | 13 | 6 | 7 |
| 312767158 | 18 | 5 | 9 | 10 |
| 315704986 | 21 | 5 | 8 | 8 |
| 322480264 | 23 | 5 | 7 | 7 |
| 325211114 | 21 | 5 | 7 | 9 |
| 336562968 | 19 | 5 | 6 | 8 |
| ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
| 1461023866 | 54 | 17 | 16 | 25 |
| 1566529670 | 58 | 25 | 14 | 38 |
| 1873167065 | 75 | 38 | 19 | 65 |
| 2097220269 | 80 | 56 | 19 | 100 |
| 2117864069 | 58 | 66 | 21 | 44 |
| 2184427231 | 47 | 38 | 21 | 47 |
| 2307772436 | 57 | 42 | 23 | 50 |
| 2382053021 | 46 | 53 | 16 | 31 |
| 2539199585 | 70 | 76 | 14 | 45 |
| 2662097003 | 58 | 74 | 15 | 52 |
| 2739907121 | 57 | 58 | 16 | 42 |
| 2775476404 | 52 | 36 | 18 | 39 |
| 2857946610 | 57 | 40 | 16 | 39 |
| 2950589658 | 51 | 40 | 14 | 35 |
| 2987390833 | 54 | 42 | 49 | 36 |
| 3131103033 | 50 | 54 | 37 | 34 |
| 3173757166 | 62 | 41 | 36 | 42 |
| 3250031541 | 46 | 24 | 30 | 30 |
| 3469728070 | 56 | 24 | 28 | 42 |
| 3672319062 | 51 | 26 | 28 | 40 |
| 3523242342 | 54 | 26 | 38 | 49 |
| 4180536954 | 100 | 35 | 46 | 56 |
| 4390129243 | 88 | 47 | 29 | 48 |
| 4545752925 | 76 | 27 | 36 | 38 |
| 4492359898 | 96 | 35 | 28 | 32 |
| 4565790908 | 83 | 29 | 100 | 40 |
| 4631462146 | 81 | 38 | 65 | 34 |
| 4757514054 | 94 | 45 | 49 | 35 |
| 4837221517 | 73 | 43 | 35 | 29 |
| 5049627766 | 65 | 30 | 33 | 26 |
require(GGally)
ggpairs(df_M1)
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'altın_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>”
It can be seen that there is a high correlation between Google trends data of faiz, enflasyon, darphane, altın; and M1. It can also be seen that there also exists high correlation between independent variables which is the result of multicollinearty. Even there does not exist perfect multicollinearty, the variability will not be perfectly explained by different independent variables and the R squared value will be higher than expected. This might be caused by high inflation makes most of the data non-stationary by adding trend component to them. Thus, there might be existing high correlation caused by increasing trend in all data sets.
tslm_M1_1 <- tslm(M1_ts ~ faiz_ts + enflasyon_ts + darphane_ts + altın_ts)
tslm_M1_2 <- tslm(M1_ts ~ faiz_ts + enflasyon_ts + darphane_ts)
tslm_M1_3 <- tslm(M1_ts ~ enflasyon_ts + darphane_ts)
summary(tslm_M1_1)
summary(tslm_M1_2)
summary(tslm_M1_3)
Call:
tslm(formula = M1_ts ~ faiz_ts + enflasyon_ts + darphane_ts +
altın_ts)
Residuals:
Min 1Q Median 3Q Max
-2.101e+09 -3.856e+08 6.162e+07 1.962e+08 2.554e+09
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -613195874 127466409 -4.811 4.53e-06 ***
faiz_ts 11854213 4671710 2.537 0.0125 *
enflasyon_ts 23299524 5698982 4.088 8.00e-05 ***
darphane_ts 43165538 5579745 7.736 3.98e-12 ***
altın_ts 8265582 6046416 1.367 0.1742
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 662400000 on 117 degrees of freedom
Multiple R-squared: 0.75, Adjusted R-squared: 0.7414
F-statistic: 87.74 on 4 and 117 DF, p-value: < 2.2e-16
Call:
tslm(formula = M1_ts ~ faiz_ts + enflasyon_ts + darphane_ts)
Residuals:
Min 1Q Median 3Q Max
-2.066e+09 -3.793e+08 6.262e+07 1.913e+08 2.470e+09
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -606002904 127825722 -4.741 6.00e-06 ***
faiz_ts 14144476 4376990 3.232 0.0016 **
enflasyon_ts 26342318 5265606 5.003 1.99e-06 ***
darphane_ts 44715340 5483430 8.155 4.25e-13 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 664800000 on 118 degrees of freedom
Multiple R-squared: 0.746, Adjusted R-squared: 0.7395
F-statistic: 115.5 on 3 and 118 DF, p-value: < 2.2e-16
Call:
tslm(formula = M1_ts ~ enflasyon_ts + darphane_ts)
Residuals:
Min 1Q Median 3Q Max
-2.502e+09 -2.761e+08 -3.878e+07 1.683e+08 2.571e+09
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -374645564 110016673 -3.405 0.000902 ***
enflasyon_ts 37138442 4228456 8.783 1.41e-14 ***
darphane_ts 52701533 5085463 10.363 < 2e-16 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 690700000 on 119 degrees of freedom
Multiple R-squared: 0.7235, Adjusted R-squared: 0.7189
F-statistic: 155.7 on 2 and 119 DF, p-value: < 2.2e-16
In our first model, I have obtained the null hypothesis that the we fail to reject the coefficient of altın_ts will be zero so in my second model, I have not added altın_ts as independent variable. As it can be seen from the resiual standard error results and adjusted R squared results, the model is somehow can be an explanation to the actual data. From the table provided below, It can bee seen that the performance metric results of all three models are close to each other. Obtaining adjusted R squared value close to 0.74 is good for the explanation of variability for our data. If we applied transformation techniques and obtained values, we would have obtained better results.
CV_data <- data.frame(rbind(CV(tslm_M1_1), CV(tslm_M1_2), CV(tslm_M1_3)))
CV_data
| CV | AIC | AICc | BIC | AdjR2 |
|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
| 5.077549e+17 | 4962.855 | 4963.586 | 4979.679 | 0.7414411 |
| 4.935865e+17 | 4962.789 | 4963.306 | 4976.809 | 0.7395375 |
| 5.299412e+17 | 4971.134 | 4971.476 | 4982.350 | 0.7188692 |
By making both dependent variable and independent variables stationary, eliminating outliers and applying moving average methods to smooth the data, the graph provided below would have been improved.
autoplot(M1_ts, series = "Actual Data") +
autolayer(fitted(tslm_M1_1), series = "Model Result")
checkresiduals(tslm_M1_1)
checkresiduals(tslm_M1_2)
checkresiduals(tslm_M1_3)
Breusch-Godfrey test for serial correlation of order up to 24 data: Residuals from Linear regression model LM test = 91.051, df = 24, p-value = 9.651e-10
Breusch-Godfrey test for serial correlation of order up to 24 data: Residuals from Linear regression model LM test = 87.525, df = 24, p-value = 3.688e-09
Breusch-Godfrey test for serial correlation of order up to 24 data: Residuals from Linear regression model LM test = 80.951, df = 24, p-value = 4.289e-08
When we check the autocorrelation function of residuals it can be seen that there exists high autocorrelation for low lag values which indicates that there is a need for differencing. It can be seen that the residuals are likely to be around zero mean however there does not exist constant variance. This constant variance can be obtained by log transformation and box-cox transformation techniques since our independent variable and dependent variables are not even stationary. From the provided scatter plots below, it can be observed that for small money supply amounts the residuals did not scattered randomly and form a cluster however for higher values, they are distributed more randomly. This indicated that there still exists some variablity that could be captured by our model.
df_M1[,"Residuals"] <- as.numeric(residuals(tslm_M1_1))
ggplot(df_M1, aes(x = M1, y = Residuals)) + geom_point()
ggplot(df_M1, aes(x = fitted(tslm_M1_1), y = Residuals)) + geom_point()
Don't know how to automatically pick scale for object of type <ts>. Defaulting
to continuous.
Unemployment Rate Model:
It can be observed that our unemployment rate graph is cyclic.
autoplot(unemployment_rate_ts) + ggtitle("Unemployment Rate vs Time") + xlab("Year") + ylab("Unemployment Rate")
It can be observed that there exists high autocorrelation function values for small lag amounts which shows us that the need for an autoregressive model or making data stationary.
ggAcf(unemployment_rate_ts, lag.max = 120)
ggAcf(unemployment_rate_ts)
df_unemployment_rate <- cbind(unemployment_rate_data[,-1], iş_ilanları_data$Amount, enflasyon_data$Amount, işsizlik_sigortası_data$Amount, salgın_hastalık_data$Amount, işsizlik_data$Amount)
df_unemployment_rate
| Rate | iş_ilanları_data$Amount | enflasyon_data$Amount | işsizlik_sigortası_data$Amount | salgın_hastalık_data$Amount | işsizlik_data$Amount |
|---|---|---|---|---|---|
| <dbl> | <int> | <int> | <int> | <int> | <int> |
| 10.5 | 45 | 9 | 14 | 7 | 18 |
| 10.5 | 46 | 5 | 15 | 3 | 22 |
| 9.4 | 40 | 4 | 13 | 3 | 16 |
| 8.8 | 40 | 5 | 13 | 4 | 18 |
| 8.4 | 39 | 5 | 12 | 4 | 17 |
| 9.0 | 45 | 5 | 14 | 3 | 19 |
| 9.7 | 44 | 5 | 12 | 3 | 19 |
| 10.1 | 46 | 3 | 12 | 5 | 17 |
| 10.1 | 51 | 3 | 14 | 4 | 20 |
| 10.9 | 47 | 4 | 12 | 4 | 18 |
| 10.4 | 52 | 4 | 15 | 3 | 21 |
| 10.8 | 50 | 5 | 13 | 2 | 21 |
| 11.9 | 52 | 9 | 16 | 1 | 24 |
| 11.7 | 55 | 6 | 14 | 3 | 22 |
| 10.4 | 51 | 6 | 12 | 4 | 22 |
| 9.6 | 46 | 5 | 13 | 2 | 20 |
| 8.9 | 44 | 7 | 13 | 3 | 21 |
| 9.6 | 55 | 9 | 12 | 3 | 23 |
| 10.0 | 52 | 7 | 13 | 2 | 21 |
| 10.0 | 56 | 4 | 12 | 2 | 21 |
| 10.3 | 53 | 4 | 10 | 3 | 20 |
| 10.5 | 58 | 4 | 11 | 3 | 21 |
| 10.2 | 53 | 6 | 13 | 3 | 24 |
| 10.9 | 54 | 9 | 14 | 3 | 24 |
| 11.5 | 55 | 13 | 17 | 4 | 40 |
| 11.0 | 62 | 5 | 16 | 2 | 38 |
| 10.1 | 58 | 5 | 12 | 2 | 34 |
| 9.1 | 55 | 5 | 12 | 3 | 32 |
| 9.0 | 55 | 5 | 12 | 3 | 28 |
| 10.1 | 60 | 5 | 13 | 3 | 29 |
| ⋮ | ⋮ | ⋮ | ⋮ | ⋮ | ⋮ |
| 11.1 | 64 | 17 | 5 | 28 | 26 |
| 10.7 | 57 | 25 | 6 | 6 | 25 |
| 10.9 | 51 | 38 | 7 | 3 | 25 |
| 11.3 | 48 | 56 | 7 | 6 | 35 |
| 12.1 | 56 | 66 | 9 | 6 | 43 |
| 11.4 | 59 | 38 | 7 | 5 | 39 |
| 11.4 | 58 | 42 | 8 | 5 | 34 |
| 10.6 | 48 | 53 | 7 | 5 | 34 |
| 10.1 | 52 | 76 | 7 | 7 | 28 |
| 9.7 | 60 | 74 | 7 | 5 | 34 |
| 10.6 | 57 | 58 | 6 | 5 | 39 |
| 9.8 | 59 | 36 | 8 | 3 | 36 |
| 9.9 | 59 | 40 | 7 | 4 | 33 |
| 9.9 | 57 | 40 | 7 | 4 | 31 |
| 9.9 | 53 | 42 | 6 | 8 | 30 |
| 10.4 | 51 | 54 | 9 | 13 | 39 |
| 10.3 | 56 | 41 | 8 | 10 | 42 |
| 10.7 | 55 | 24 | 6 | 10 | 34 |
| 10.2 | 56 | 24 | 8 | 6 | 34 |
| 10.0 | 45 | 26 | 10 | 6 | 31 |
| 8.8 | 47 | 26 | 6 | 4 | 30 |
| 9.0 | 49 | 35 | 10 | 6 | 38 |
| 9.7 | 60 | 47 | 7 | 6 | 38 |
| 9.2 | 55 | 27 | 6 | 7 | 34 |
| 8.9 | 57 | 35 | 7 | 13 | 35 |
| 8.2 | 49 | 29 | 6 | 11 | 33 |
| 8.8 | 47 | 38 | 6 | 8 | 31 |
| 8.9 | 44 | 45 | 7 | 16 | 36 |
| 9.8 | 49 | 43 | 7 | 29 | 42 |
| 9.7 | 45 | 30 | 10 | 9 | 38 |
require(GGally)
ggpairs(df_unemployment_rate)
Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'iş_ilanları_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_sigortası_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <c4>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'salgın_hastalık_data$Amount' in 'mbcsToSbcs': dot substituted for <b1>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <c5>” Warning message in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : “conversion failure on 'işsizlik_data$Amount' in 'mbcsToSbcs': dot substituted for <9f>”
tslm_unemployment_rate_1 <- tslm(unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts + salgın_hastalık_ts + işsizlik_sigortası_ts + işsizlik_ts)
tslm_unemployment_rate_2 <- tslm(unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts + salgın_hastalık_ts + işsizlik_ts)
tslm_unemployment_rate_3 <- tslm(unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts + işsizlik_ts)
summary(tslm_unemployment_rate_1)
summary(tslm_unemployment_rate_2)
summary(tslm_unemployment_rate_3)
Call:
tslm(formula = unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts +
salgın_hastalık_ts + işsizlik_sigortası_ts + işsizlik_ts)
Residuals:
Min 1Q Median 3Q Max
-2.17093 -0.80596 -0.08229 0.68503 3.06319
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.108889 0.667855 9.147 2.36e-15 ***
iş_ilanları_ts 0.063310 0.008408 7.530 1.20e-11 ***
enflasyon_ts -0.017956 0.008110 -2.214 0.028784 *
salgın_hastalık_ts 0.023155 0.011965 1.935 0.055392 .
işsizlik_sigortası_ts -0.016515 0.041892 -0.394 0.694140
işsizlik_ts 0.046211 0.013285 3.478 0.000711 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.124 on 116 degrees of freedom
Multiple R-squared: 0.5313, Adjusted R-squared: 0.5111
F-statistic: 26.3 on 5 and 116 DF, p-value: < 2.2e-16
Call:
tslm(formula = unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts +
salgın_hastalık_ts + işsizlik_ts)
Residuals:
Min 1Q Median 3Q Max
-2.1160 -0.8259 -0.1021 0.6669 3.1330
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.936762 0.503535 11.790 < 2e-16 ***
iş_ilanları_ts 0.063780 0.008293 7.691 5.04e-12 ***
enflasyon_ts -0.016136 0.006644 -2.429 0.016678 *
salgın_hastalık_ts 0.023802 0.011809 2.016 0.046132 *
işsizlik_ts 0.044248 0.012273 3.605 0.000459 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.12 on 117 degrees of freedom
Multiple R-squared: 0.5307, Adjusted R-squared: 0.5147
F-statistic: 33.08 on 4 and 117 DF, p-value: < 2.2e-16
Call:
tslm(formula = unemployment_rate_ts ~ iş_ilanları_ts + enflasyon_ts +
işsizlik_ts)
Residuals:
Min 1Q Median 3Q Max
-2.0833 -0.8053 -0.0648 0.5990 3.1677
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 6.042571 0.507249 11.912 < 2e-16 ***
iş_ilanları_ts 0.057940 0.007871 7.361 2.66e-11 ***
enflasyon_ts -0.018134 0.006655 -2.725 0.00741 **
işsizlik_ts 0.058272 0.010241 5.690 9.40e-08 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.134 on 118 degrees of freedom
Multiple R-squared: 0.5144, Adjusted R-squared: 0.5021
F-statistic: 41.67 on 3 and 118 DF, p-value: < 2.2e-16
I have subtracted işsizlik sigortası time series from my model since it had too large p value and I created a new model and obtained better results as it can be seen from the table provided below. From the table below, it can be seen that the model that yields best results is the second model so I will be proceeding with it.
CV_data <- data.frame(rbind(CV(tslm_unemployment_rate_1), CV(tslm_unemployment_rate_2), CV(tslm_unemployment_rate_3)))
CV_data
| CV | AIC | AICc | BIC | AdjR2 |
|---|---|---|---|---|
| <dbl> | <dbl> | <dbl> | <dbl> | <dbl> |
| 1.429387 | 36.29801 | 37.28046 | 55.92616 | 0.5111465 |
| 1.383645 | 34.46135 | 35.19178 | 51.28548 | 0.5146754 |
| 1.310680 | 36.62576 | 37.14300 | 50.64587 | 0.5020789 |
From the actual data vs model result plot provided below, it can be seen that our model captures some information from actual data and creates well enough model result.
autoplot(unemployment_rate_ts, series = "Actual Data") +
autolayer(fitted(tslm_unemployment_rate_2), series = "Model Result")
checkresiduals(tslm_unemployment_rate_1)
checkresiduals(tslm_unemployment_rate_2)
checkresiduals(tslm_unemployment_rate_3)
Breusch-Godfrey test for serial correlation of order up to 24 data: Residuals from Linear regression model LM test = 86.587, df = 24, p-value = 5.253e-09
Breusch-Godfrey test for serial correlation of order up to 24 data: Residuals from Linear regression model LM test = 86.204, df = 24, p-value = 6.069e-09
Breusch-Godfrey test for serial correlation of order up to 24 data: Residuals from Linear regression model LM test = 86.535, df = 24, p-value = 5.358e-09
Since the Breusch-Godfrey test results are strictly low, we reject that there exists no autocorrelation for residuals or we obtained good heterodasticity. It can be seen that residuals do not have constant variance, which indicated that our data was not stationary as I have mentioned. And there is a downward regular decreasing trend in autocorrelation function plot, which indicates the need for making the data stationary. However the distribution of residuals provided below is not that biased which would show the need for explanation of heterodasticity but not the model as a whole.
df_unemployment_rate[,"Residuals"] <- as.numeric(residuals(tslm_unemployment_rate_2))
ggplot(df_M1, aes(x = fitted(tslm_unemployment_rate_2), y = Residuals)) + geom_point()
Don't know how to automatically pick scale for object of type <ts>. Defaulting
to continuous.
Conclusion:
To conclude, some of the Google Trends data were able to explain the patterns and behaviours of relevant TCMB data and some were not. I have obtained different metric values and performance measures for different models. The data for our dependent variables showed an increasing trend in each of the three models we constructed. This suggests that there is non-stationarity in our time series data. But stationary time series data is required for time series regression models to meet the assumptions and produce accurate forecasts. We were unable to make our data stationary for this project. Consequently, we were incapable of come up with a reliable time series regression model, as seen by our scatter plots and test outcomes. We will need to use transformation and differencing techniques to our independent and dependent datasets in order to fix this problem. Furthermore, additional thorough analyses will be needed. Even though there was some correlation and explanatory power between the dependent and selected independent variables, we were unable to create a solid prediction model due to the absence of proper, stationary datasets. Going forward, more work will be focused on turning the data into a stationary form so that we can create reliable time series regression models that can produce reliable forecasts.